package com.jingtai.platform.controller.shop;

import com.jingtai.core.entity.shop.Evaluation;
import com.jingtai.platform.service.shop.EvaluationService;
import com.jingtai.platform.util.ResultUtil;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.jingtai.validate.swagger.CApiParam;

/**
 * 评价表
 *
 * @author sunlaiqian
 * @date 2020-12-02 18:31:33
 */
@Validated
@RestController
@RequestMapping("/platform/evaluation")
@Api(tags = "评价表")
public class EvaluationController{

    @Autowired
    private EvaluationService evaluationService;


    @ApiOperation("评价表列表查询")
    @GetMapping("/list")
    public ResultUtil aopEvaluationList(@CApiParam(name = "page",value = "页数",required = true,cNotEmpty = true,cIntMin = 1) @RequestParam("page") Integer page,
                              @CApiParam(name = "limit",value = "每页个数",required = true,cNotEmpty = true,cIntMin = 1) @RequestParam("limit") Integer limit,
                              @CApiParam(name = "conditions",value = "查询条件",required = false) @RequestParam("conditions") String conditions){
        return evaluationService.Evaluationlist(page, limit, conditions);
    }


    @ApiOperation("根据ID查询evaluation实体")
    @GetMapping("/getEvaluationById")
    public ResultUtil GetEvaluationById(@CApiParam(name = "id",value = "evaluation实体ID",required = true,cNotEmpty = true) @RequestParam("id") Long id){
        return evaluationService.getEvaluationById(id);
    }


    @ApiOperation("新增evaluation实体")
    @PostMapping("/add")
    @ApiOperationSupport(ignoreParameters = {"evaluation.id","evaluation.createTime","evaluation.updateTime","evaluation.deleteFlag"})
    public ResultUtil aopAddEvaluation(@RequestBody @Validated Evaluation evaluation){
        return evaluationService.addEvaluation(evaluation);
    }

    @ApiOperation("编辑evaluation实体")
    @PostMapping("/edit")
    @ApiOperationSupport(ignoreParameters = {"evaluation.createTime","evaluation.updateTime","evaluation.deleteFlag"})
    public ResultUtil aopEditEvaluation(@RequestBody @Validated Evaluation evaluation){
        return evaluationService.editEvaluation(evaluation);
    }

    @ApiOperation("根据ID删除evaluation实体")
    @GetMapping("/delEvaluationById")
    public ResultUtil aopDelEvaluationById(@CApiParam(name = "id",value = "evaluation实体ID",required = true,cNotEmpty = true) @RequestParam("id") Long id){
        return evaluationService.delEvaluationById(id);
    }

}






